﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Partial Class FrontEnd_Control_HoTro
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Bind2Grid()
        End If
    End Sub
    Protected Sub Bind2Grid()
        Using _data As New VSEntities
            Dim p = (From q In _data.Menus Where q.TitlePage = "ho-tro" Select q).FirstOrDefault
            If Not p Is Nothing Then
                ltrTitle.Text = p.Title
                Page.Title = p.Title

                Dim k = (From q In _data.Menus Where q.ParentId = p.MenuId Select q).ToList
                With rptCauHoiThuongGap
                    .DataSource = k
                    .DataBind()
                End With
                With rptCauHoiChiTiet
                    .DataSource = k
                    .DataBind()
                End With
            End If

        End Using
    End Sub
    Protected Sub rptCauHoiThuongGap_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptCauHoiThuongGap.ItemDataBound
        Dim row As Menu = e.Item.DataItem
        Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
        ' hplTitle.NavigateUrl = MainDomain & "ho-tro.html?Id=" & row.MenuId
        'hplTitle.Attributes.Add("onclick(), javascript(showhide(" + row.MenuId + ")); ")
        hplTitle.Text = row.Title
    End Sub
    Protected Sub rptNoiDung_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptCauHoiChiTiet.ItemDataBound
        Dim ltrNumber As Literal = CType(e.Item.FindControl("ltrNumber"), Literal)
        ltrNumber.Text = e.Item.ItemIndex + 1

        Dim row As Menu = e.Item.DataItem
        Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
        'hplTitle.NavigateUrl = MainDomain & "ho-tro.html?Id=" & row.MenuId
        hplTitle.Text = row.Title

        Dim ltrDescription As Literal = CType(e.Item.FindControl("ltrDescription"), Literal)
        ltrDescription.Text = row.Description

    End Sub
End Class
